package com.dataseek.iot.mysql.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dataseek.iot.core.response.ResponseEntity;
import com.dataseek.iot.mysql.entity.MqttTopic;
import com.dataseek.iot.mysql.mapper.MqttTopicMapper;
import com.dataseek.iot.mysql.service.IMqttTopicService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author cc
 * @since 2021-09-28
 */
@Service
public class MqttTopicServiceImpl extends ServiceImpl<MqttTopicMapper, MqttTopic> implements IMqttTopicService {

    public List findByDeviceCode(String code){
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("device_code", code);
        List<MqttTopic> topics = this.list(wrapper);
        return topics;
    }

    public void deleteDeviceByCode(String code){
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("device_code", code);
        this.remove(wrapper);
    }
}
